package com.docMan.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.hibernate.Criteria;
import org.hibernate.FetchMode;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.docMan.dao.TcunitDao;
import com.docMan.dao.pojo.Tcunit;

@Repository("tcunitDao")
public class TcunitDaoImpl extends BaseDaoImpl<Tcunit> implements TcunitDao {
	
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Tcunit> findTcunit() {
		Criteria criteria=getCSession().createCriteria(clazz);
		criteria.add(Restrictions.eq("seniorUnitId", new Integer(1)));
		criteria.setFetchMode("humans", FetchMode.JOIN);
		criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
		List<Tcunit> list=criteria.list();
		return list;
	}

	@Resource(name="sessionFactoryUser")
	@Override
	public void setSuperSessionFactory(SessionFactory sessionFactory) {
		// TODO Auto-generated method stub
		super.setSuperSessionFactory(sessionFactory);
	}
	

}
